<template>
	<view class="cashout-go">
		

		<view class="input-amount">
			<u-form>
				<u-input
				    placeholder="请输入提现金额"
				    border="bottom"
					type="number"
					v-model="amount"
				    clearable
				  ></u-input>
			</u-form>

		</view>
		
		<view class="cashout-btn">
			<u-button type="primary"  @click="do_cashout">提现</u-button>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	const appInstance = getApp();
	export default{
		
		data() {
			return {
				
				amount:'', //  提现金额
			}
		},
		
		onLoad( options ) {
			
			
		},
		
		methods:{
			
			do_cashout:function(){
				
				var t = this;
				var url = '&r=balance.cashout';
				var data = {
					amount:this.amount
				};

				appInstance.globalData.request(url, data, 'POST', res=>{
					
					if( !res.data.status ){
						t.$refs.uToast.show({
							type:'success',
							title:'提现申请成功，请耐心等待审核',
							callback(){
								console.log('complete')
								uni.navigateBack({
									delta: 1,
								})
							}
						})
					}else{
						t.$refs.uToast.show({
							type:'error',
							title:res.data.description
							? res.data.description
							: '提现申请失败',
						})
					}
					
				});
			}
			
		}
		
		
	}
</script>

<style lang="less">
	
	.cashout-go{
		padding:100rpx 20rpx;
		.input-amount{
			
		}	
		.cashout-btn{
			
			margin-top:100rpx;
			
		}
	}

</style>
